﻿#ifndef			_XANADU_CORE_BYTE_TERNARY_H_
#define			_XANADU_CORE_BYTE_TERNARY_H_

#include <XanaduCore/XHeader.h>

/// <summary>
///  A ternary value type
/// The value types are true / false / null(undefined)
/// </summary>
class XANADU_CORE_EXPORT XTernary
{
public:
	// value types
	enum Type
	{
		kNull = 0,		// The value equal to 0 is null
		kTrue = 1,		// All values greater than 0 are true
		kFalse = -1,		// All values less than 0 are false
	};

private:
	Type				_memberType = kNull;

public:
	// constructor
	XTernary() noexcept;

	// constructor
	XTernary(Type _Type) noexcept;

	// constructor
	XTernary(bool _Value) noexcept;

	// constructor
	XTernary(char _Value) noexcept;

	// constructor
	XTernary(unsigned char _Value) noexcept;

	// constructor
	XTernary(short _Value) noexcept;

	// constructor
	XTernary(unsigned short _Value) noexcept;

	// constructor
	XTernary(int _Value) noexcept;

	// constructor
	XTernary(unsigned int _Value) noexcept;

	// constructor
	XTernary(long _Value) noexcept;

	// constructor
	XTernary(unsigned long _Value) noexcept;

	// constructor
	XTernary(long long _Value) noexcept;

	// constructor
	XTernary(unsigned long long _Value) noexcept;

	// constructor
	XTernary(const void* _Value) noexcept;

	// constructor
	XTernary(const XTernary& _Other) noexcept;

	// constructor
	XTernary(XTernary&& _Other) noexcept;

	// destructor
	virtual ~XTernary() noexcept;

public:
	// [opt] operators overload =
	XTernary& operator = (Type _Type) noexcept;

	// [opt] operators overload =
	XTernary& operator = (bool _Value) noexcept;

	// [opt] operators overload =
	XTernary& operator = (char _Value) noexcept;

	// [opt] operators overload =
	XTernary& operator = (unsigned char _Value) noexcept;

	// [opt] operators overload =
	XTernary& operator = (short _Value) noexcept;

	// [opt] operators overload =
	XTernary& operator = (unsigned short _Value) noexcept;

	// [opt] operators overload =
	XTernary& operator = (int _Value) noexcept;

	// [opt] operators overload =
	XTernary& operator = (unsigned int _Value) noexcept;

	// [opt] operators overload =
	XTernary& operator = (long _Value) noexcept;

	// [opt] operators overload =
	XTernary& operator = (unsigned long _Value) noexcept;

	// [opt] operators overload =
	XTernary& operator = (long long _Value) noexcept;

	// [opt] operators overload =
	XTernary& operator = (unsigned long long _Value) noexcept;

	// [opt] operators overload =
	XTernary& operator = (const void* _Value) noexcept;

	// [opt] operators overload =
	XTernary& operator = (const XTernary& _Other) noexcept;

	// [opt] operators overload =
	XTernary& operator = (XTernary&& _Other) noexcept;

public:
	// [opt] operators overload ==
	bool operator == (Type _Type) const noexcept;

	// [opt] operators overload ==
	bool operator == (bool _Value) const noexcept;

	// [opt] operators overload ==
	bool operator == (char _Value) const noexcept;

	// [opt] operators overload ==
	bool operator == (unsigned char _Value) const noexcept;

	// [opt] operators overload ==
	bool operator == (short _Value) const noexcept;

	// [opt] operators overload ==
	bool operator == (unsigned short _Value) const noexcept;

	// [opt] operators overload ==
	bool operator == (int _Value) const noexcept;

	// [opt] operators overload ==
	bool operator == (unsigned int _Value) const noexcept;

	// [opt] operators overload ==
	bool operator == (long _Value) const noexcept;

	// [opt] operators overload ==
	bool operator == (unsigned long _Value) const noexcept;

	// [opt] operators overload ==
	bool operator == (long long _Value) const noexcept;

	// [opt] operators overload ==
	bool operator == (unsigned long long _Value) const noexcept;

	// [opt] operators overload ==
	bool operator == (const void* _Value) const noexcept;

	// [opt] operators overload ==
	bool operator == (const XTernary& _Other) const noexcept;

public:
	// [opt] operators overload !=
	bool operator != (Type _Type) const noexcept;

	// [opt] operators overload !=
	bool operator != (bool _Value) const noexcept;

	// [opt] operators overload !=
	bool operator != (char _Value) const noexcept;

	// [opt] operators overload !=
	bool operator != (unsigned char _Value) const noexcept;

	// [opt] operators overload !=
	bool operator != (short _Value) const noexcept;

	// [opt] operators overload !=
	bool operator != (unsigned short _Value) const noexcept;

	// [opt] operators overload !=
	bool operator != (int _Value) const noexcept;

	// [opt] operators overload !=
	bool operator != (unsigned int _Value) const noexcept;

	// [opt] operators overload !=
	bool operator != (long _Value) const noexcept;

	// [opt] operators overload !=
	bool operator != (unsigned long _Value) const noexcept;

	// [opt] operators overload !=
	bool operator != (long long _Value) const noexcept;

	// [opt] operators overload !=
	bool operator != (unsigned long long _Value) const noexcept;

	// [opt] operators overload !=
	bool operator != (const void* _Value) const noexcept;

	// [opt] operators overload !=
	bool operator != (const XTernary& _Other) const noexcept;

public:
	// [opt] convert parameter to ternary type
	static Type convert(bool _Value) noexcept;

	// [opt] convert parameter to ternary type
	static Type convert(char _Value) noexcept;

	// [opt] convert parameter to ternary type
	static Type convert(unsigned char _Value) noexcept;

	// [opt] convert parameter to ternary type
	static Type convert(short _Value) noexcept;

	// [opt] convert parameter to ternary type
	static Type convert(unsigned short _Value) noexcept;

	// [opt] convert parameter to ternary type
	static Type convert(int _Value) noexcept;

	// [opt] convert parameter to ternary type
	static Type convert(unsigned int _Value) noexcept;

	// [opt] convert parameter to ternary type
	static Type convert(long _Value) noexcept;

	// [opt] convert parameter to ternary type
	static Type convert(unsigned long _Value) noexcept;

	// [opt] convert parameter to ternary type
	static Type convert(long long _Value) noexcept;

	// [opt] convert parameter to ternary type
	static Type convert(unsigned long long _Value) noexcept;

	// [opt] convert parameter to ternary type
	static Type convert(const void* _Value) noexcept;

public:
	// [get] type
	virtual Type type() const noexcept;

public:
	// [get] Is Null
	virtual bool isNull() const noexcept;

	// [get] Is Null
	virtual bool isEmpty() const noexcept;

	// [get] Is Ture
	virtual bool isTure() const noexcept;

	// [get] Is False
	virtual bool isFalse() const noexcept;
};

#endif
